Skip to main content

All Questions

Tagged with
0votes
1answer
100views

How to do replace with the dte editor

The dte editor a small and easy to use console text editor. In readme or its online doc, both says: Regex search and replace (are the key features). However, I haven't found how to do the replace ...
xpt's user avatar
  • 1,808
0votes
2answers
291views

insert block of lines only before first matched pattern

i need to insert the below lines (after variable substitution) before the first matched string which is server { in /etc/nginx/nginx.conf Variable: website=www.hello.com Block of lines: server { # ...
Ashar's user avatar
0votes
1answer
157views

How to replace text in file - conditions and arithmetic required

I need a script to change content in some text files. This a bit beyond my limited bash skills. Maybe perl or python would be a better approach, I have no experience with either of these. I have a ...
jamitin's user avatar
0votes
1answer
2kviews

Simple Binary Replacement

I tried using bbe as below bbe -e 's/01110011/01111000/' test.txt All I'm trying to accomplish in this example is to read the file as if it's a binary file, and replacing the letter s with x. I'm ...
Andrew Wei's user avatar
2votes
3answers
296views

Replacing two patterns in a text files at the same time [duplicate]

I have a text file contain numbers as follows: 34 77 1716 150?.2 67.5892 11.9691 23 1?6 83 35 78 0 0 0 0 0 0 0 36 79 0 0 0 0 0 0 0 37 80 0 0 ? ? 0 0 0 38 81 0 0 0 ? 0 0 0 39 82 0 0 0 0 ? 0 ? 40 85 ...
user avatar
0votes
1answer
563views

How to make "incremental" replace in files with bash

I need to search files in directory with specific pattern (for example foobar) and replace them with foobarXXX, where XXX is a number. For example, there were two original file snt130.txt My ...
Loom's user avatar
  • 4,043
1vote
2answers
2kviews

replace a block of text with the contents of a file

I would like to replace the contents between $Elements$ and $EndElements$ in text file, f1, with the data from another file, f2. The contents of f1 is given simply by $Elements$ 3 1 5 7 $EndElements$...
Umut Tabak's user avatar
3votes
3answers
406views

Replace content inside two specific lines

How to replace, from command-line, the content between <!-- Analytics code start --> and <!-- Analytics code end --> of index.html: <html> ... <!-- Analytics code start --> .....
Basj's user avatar
  • 2,651
0votes
1answer
2kviews

Execute command in dynamic directories via shell script

My main directory is /home/hts/.hts/tvheadend/input/dvb/networks/1d38df81855dee2d39e692ecc4caf05c/muxes In there are many more directories with radomly generated names Example: /...
Daniel's user avatar
0votes
1answer
83views

Can you replace displayed text with something else in command window?

I am trying to manage user accounts. They are basically just numbers, but I would rather see user last names on the screen. Is it possible to automatically replace displayed text with something else? ...
lazy8s's user avatar
1vote
1answer
1kviews

How can I find and replace only in a range of columns?

I have a text file with 9267 lines. I want to find "A" with 5 spaces after it and replace it with "A" with 5 spaces before and after it on all lines, but only between columns 67 and 88. Text outside ...
aswine's user avatar
0votes
1answer
73views

text replacing in data file with peculiar spacing

I have a text (.qdp) file with many data stored. In some rows, the data are too many to be on just one line. Then, the program that saves the data, use a minus sign (-) to go on the new line, and ...
Py-ser's user avatar

close